<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>EnTech FPK: C:/Users/Sam/Projects/FRC/Libraries/Fpk/Entech-Fpk-Subscribers/Entech-Fpk/Actuators/PidMotorController.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">EnTech FPK
   &#160;<span id="projectnumber">1</span>
   </div>
   <div id="projectbrief">FRC Programming Kit by the EnTech 281 GreenVillains</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_c29fdd72b58e0fec779998d59b4fd826.html">Actuators</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">PidMotorController.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Have include guard.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#ifndef PIDENCODERSPEEDCONTROLLER_HPP</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define PIDENCODERSPEEDCONTROLLER_HPP</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;WPILib.h&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html">   10</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_pid_motor_controller.html">PidMotorController</a> :</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;        <span class="keyword">public</span> SpeedController, <span class="keyword">public</span> PIDSource</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000">   17</a></span>&#160;                <span class="keyword">enum</span> <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000">ControlMode</a></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;                {</div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ac0237a20da41d0e3e0d8580f80ef4c04">   20</a></span>&#160;                        <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ac0237a20da41d0e3e0d8580f80ef4c04" title="The PercentVBus control mode sets the percentage of voltage sent to the motor.">PercentVBus</a> = CANJaguar::kPercentVbus,</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;                        </div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000a943fee08c50fe4d9b9b34fb8e876b46f">   23</a></span>&#160;                        <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000a943fee08c50fe4d9b9b34fb8e876b46f" title="The Speed control mode sets the speed that the motor spins.">Speed</a> = CANJaguar::kSpeed,</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;                        </div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ace273af498d1fda861939cfa5969ac0d">   26</a></span>&#160;                        <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ace273af498d1fda861939cfa5969ac0d" title="The Position control mode sets the position or distance for the motor to spin to.">Position</a> = CANJaguar::kPosition,</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;                        </div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ae344611d419ee7d0db9e299783c77497">   29</a></span>&#160;                        <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000ae344611d419ee7d0db9e299783c77497" title="The Voltage control mode sets the voltage sent to the motor.">Voltage</a> = CANJaguar::kVoltage,</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;                        </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000a7b7f434ca2ce980d197feccc28e7bfa1">   32</a></span>&#160;                        <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000a7b7f434ca2ce980d197feccc28e7bfa1" title="The Current control mode sets the current sent to the motor.">Current</a> = CANJaguar::kCurrent,</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                };</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="struct_pid_motor_controller_1_1_pid.html">   38</a></span>&#160;                <span class="keyword">struct </span><a class="code" href="struct_pid_motor_controller_1_1_pid.html">Pid</a></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                {</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="struct_pid_motor_controller_1_1_pid.html#abe7c8a11ca0309a9895fceb256b3341a">   48</a></span>&#160;                                <span class="keyword">inline</span> <a class="code" href="struct_pid_motor_controller_1_1_pid.html#abe7c8a11ca0309a9895fceb256b3341a">Pid</a>(<span class="keywordtype">double</span> p, <span class="keywordtype">double</span> i, <span class="keywordtype">double</span> d)</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;                                {</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                                        m_p = p;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;                                        m_i = i;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                                        m_d = d;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                                }</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                                </div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="code" href="struct_pid_motor_controller_1_1_pid.html#a4033a3711f18b08654efc2fd3fd5bf79">   60</a></span>&#160;                                <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="struct_pid_motor_controller_1_1_pid.html#a4033a3711f18b08654efc2fd3fd5bf79">GetP</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keyword">                                </span>{</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;                                        <span class="keywordflow">return</span> m_p;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                                }</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                                </div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="code" href="struct_pid_motor_controller_1_1_pid.html#a387fdd94ba1ba8ec754a74ea19f815b2">   70</a></span>&#160;                                <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="struct_pid_motor_controller_1_1_pid.html#a387fdd94ba1ba8ec754a74ea19f815b2">GetI</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="keyword">                                </span>{</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;                                        <span class="keywordflow">return</span> m_i;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                                }</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                                </div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="struct_pid_motor_controller_1_1_pid.html#a2d6395109782f7a53d101b6180b45a22">   80</a></span>&#160;                                <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="struct_pid_motor_controller_1_1_pid.html#a2d6395109782f7a53d101b6180b45a22">GetD</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="keyword">                                </span>{</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                                        <span class="keywordflow">return</span> m_d;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                                }</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                                <span class="keywordtype">double</span> m_p;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                                <span class="keywordtype">double</span> m_i;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                                <span class="keywordtype">double</span> m_d;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                };</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#a086b084fef771d37614d6b22a907d6a3">PIDWrite</a>(<span class="keywordtype">float</span> output);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#af2c5353a5de95fba5f18806eb6334441">PIDGet</a>();</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;                </div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#a694ac2d6827967e8449b8d8cfd4f67b0">GetSpeed</a>() = 0;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#aed237a512f0edbdc968d2a89932ba8aa">GetPosition</a>() = 0;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;                </div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                <span class="comment">/* The following function declaration is derived from </span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="comment">                 * WPILib, which is licenced under the licence specified</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="comment">                 * in &quot;Licence-WPILib.txt&quot;.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;<span class="comment">                 */</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#a43fd491df57bc20e6f54ff7bf561cb4a">Enable</a>(<span class="keywordtype">double</span> initialEncoderPosition = 0) = 0;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                </div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                <span class="keyword">virtual</span> <a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000">ControlMode</a> <a class="code" href="class_pid_motor_controller.html#a79f8cbc8e9eb867722cd0cf7eb12772a">GetControlMode</a>() = 0;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#a2bf9cf6c4eb2c98e7af07d10f408762a">SetControlMode</a>(<a class="code" href="class_pid_motor_controller.html#a13eddfb79a251f572067f2e2f214b000">ControlMode</a> mode) = 0;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;                </div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#a648fbdb1ddb88b255398a63f7c875d40">SetEncodersCodesPerRevolution</a>(UINT16 codesPerRevolution) = 0;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;                </div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#aeaa9df6864320c7aadbd1759223fea17">SetPid</a>(<span class="keywordtype">double</span> p, <span class="keywordtype">double</span> i, <span class="keywordtype">double</span> d) = 0;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;                </div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="code" href="class_pid_motor_controller.html#a3fc5e3c934175105d0b41eeb606fe326">  165</a></span>&#160;                <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_pid_motor_controller.html#aeaa9df6864320c7aadbd1759223fea17">SetPid</a>(<a class="code" href="struct_pid_motor_controller_1_1_pid.html">Pid</a> pid)</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                {</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                        <a class="code" href="class_pid_motor_controller.html#aeaa9df6864320c7aadbd1759223fea17">SetPid</a>(pid.<a class="code" href="struct_pid_motor_controller_1_1_pid.html#a4033a3711f18b08654efc2fd3fd5bf79">GetP</a>(), pid.<a class="code" href="struct_pid_motor_controller_1_1_pid.html#a387fdd94ba1ba8ec754a74ea19f815b2">GetI</a>(), pid.<a class="code" href="struct_pid_motor_controller_1_1_pid.html#a2d6395109782f7a53d101b6180b45a22">GetD</a>());</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#ac78e406263f408dbf96b8c36e6e27e46">GetP</a>() = 0;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                </div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#aff6dea3afe08690864c68b4962535fd1">GetI</a>() = 0;</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                </div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_pid_motor_controller.html#a6d40a6d4c2cbb8d34babee2fb9f5c098">GetD</a>() = 0;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;};</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;<span class="preprocessor">#endif // #ifndef PIDENCODERSPEEDCONTROLLER_HPP</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Aug 12 2013 16:46:48 for EnTech FPK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>
